package com.gem.sms.service.impl;

import com.gem.sms.dao.StudentDao;
import com.gem.sms.entity.Student;
import com.gem.sms.service.StudentService;
import com.gem.sms.util.BeanFactory;
import com.gem.sms.util.PageBean;

public class StudentServiceImpl implements StudentService {
	StudentDao sd = (StudentDao) BeanFactory.getBean("studentDao");

	@Override
	public void addStu(Student student) {
		sd.save(student);

	}

	@Override
	public Student getStudentById(String id) {
		return sd.getStudentById(id);
	}

	@Override
	public Student canLogin(String sno, String pwd) {
		return sd.canLogin(sno, pwd);
	}

	@Override
	public PageBean<Student> ListStudentsByPages(int pageNow, int pageSize, String searchName) {
		return new PageBean<Student>(sd.getPagedStudents(pageNow, pageSize, searchName), pageNow, pageSize,
				sd.getCount(searchName));
	}

	@Override
	public void updateStu(Student student) {
		sd.update(student);
	}

	@Override
	public void delete(String ids) {
		sd.delete(ids);
	}

}
